import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Work1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        Map<StringBuilder, Integer> map = new HashMap<>();
        boolean flag = false;
        StringBuilder stringBuilder = new StringBuilder();
        int count = 0;
        int i = 0;

        while (i < str.length()) {
            char ch = str.charAt(i);
            while (i < str.length() && (ch < '0' || ch > '9')) {
                i++;
                ch = str.charAt(i);
            }
            while (i < str.length() && (ch >= '0' && ch <= '9')) {
                ch = str.charAt(i);
                stringBuilder.append(ch);
                count++;
                i++;
                if (i < str.length()) {
                    ch = str.charAt(i);
                }
            }
            map.put(stringBuilder, count);
            stringBuilder = new StringBuilder();
            count = 0;
            i++;
        }
        int max = 0;

        for (Map.Entry<StringBuilder, Integer> entry : map.entrySet()) {
            if (entry.getValue() > max) {
                max = entry.getValue();
            }
        }
        for (Map.Entry<StringBuilder, Integer> entry : map.entrySet()) {
            if (entry.getValue() == max) {
                System.out.println(entry.getKey());
            }
        }

    }
}
